package com.dao;

import java.sql.SQLException;
import java.util.List;

import com.util.JdbcTemplate;
import com.vo.TrainingPlan;

public class TrainingPlanDAOImpl implements TrainingPlanDAO {
	private JdbcTemplate jdbcTemplate;
	public TrainingPlanDAOImpl() {
		jdbcTemplate = new JdbcTemplate();
	}
	

	public int delete(int id) throws SQLException {
		return 0;
	}

	public int update(TrainingPlan trainingplan) throws SQLException {
		return 0;
	}

	public TrainingPlan findById(int id) throws SQLException {
		return null;
	}

	public List<TrainingPlan> find() throws SQLException {
		return null;
	}
	@Override
	public boolean save(TrainingPlan trainingplan) throws SQLException {
		String sql = "insert into trainingplan"
				+ "(id,name,planYear,startDate,endDate,majorPlane)"
				+"values(?,?,?,?,?,?)";
		
		int m=jdbcTemplate.update(sql,trainingplan.getId(),trainingplan.getName(),
				trainingplan.getPlanYear(),trainingplan.getStartDate(),
				trainingplan.getEndDate(),trainingplan.getMajorPlane());
		
		if(m!= -1) {
			return true;
		}
		return false;
	}


	public List<TrainingPlan> getAllUser() {
		
		return null;
	}

}
